<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>箭头函数的使用</title>
</head>
<body>
    <script>
        // 没有参数
        // let test = function() {
        //     return "hello"
        // }

        let test = () =>  "hello";
        console.log(test());


        // 一个参数
        // let hd = [1,2,3,4,5].filter(function (value) {
        //     return value >= 3;
        // })

        let hd = [1,2,3,4,5].filter(value => value >= 3);
        console.log(hd);


        // 两个参数
        // let sum = [1,2,3,4,5].reduce(function (a,b) {
        //     return a + b;
        // });
        let sum = [1,2,3,4,5].reduce((a,b) =>  a + b);
        console.log(sum);
    </script>
</body>
</html>